import request from '@/utils/request'

// 查询提现申请列表
export function listWithdrawalApplication(query) {
    return request({
        url: '/dashboard/withdrawalApplication/list',
        method: 'get',
        params: query
    })
}

// 查询提现申请详细
export function getWithdrawalApplication(id) {
    return request({
        url: '/dashboard/withdrawalApplication/' + id,
        method: 'get'
    })
}

// 新增提现申请
export function addWithdrawalApplication(data) {
    return request({
        url: '/dashboard/withdrawalApplication',
        method: 'post',
        data: data
    })
}

// 修改提现申请
export function updateWithdrawalApplication(data) {
    return request({
        url: '/dashboard/withdrawalApplication',
        method: 'put',
        data: data
    })
}

// 删除提现申请
export function delWithdrawalApplication(id) {
    return request({
        url: '/dashboard/withdrawalApplication/' + id,
        method: 'delete'
    })
}

// 审批提现申请
export function approveApplication(id, data) {
    return request({
        url: '/dashboard/withdrawalApplication/approve/' + id,
        method: 'put',
        data: data
    })
}

// 获取审批人列表
export function getApprovers(roleKey) {
    return request({
        url: '/dashboard/withdrawalApplication/approvers',
        method: 'get',
        params: { roleKey }
    })
}

// 打款
export function transferToAlipay(gradWithdrawalApplicationId) {
    return request({
        url: '/dashboard/withdraw/deposit/toAlipay',
        method: 'get',
        params: { gradWithdrawalApplicationId }
    })
}